﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace BeatEmUp.Menu
{
    public class MenuExitScreen : MenuScreen
    {
        private GameManager game;
        KeyboardState oldState;
        Texture2D exitImageTexture;
        Rectangle exitImageRect;

        public MenuExitScreen(GameManager game) :
            base(game)
        {
            this.game = game;
            exitImageRect = new Rectangle(((GameManager)this.game).graphics.PreferredBackBufferWidth / 2 - 200, ((GameManager)this.game).graphics.PreferredBackBufferHeight / 2 - 200,400,400);
        }

        public void LoadContent(ContentManager content)
        {
            LoadBaseContent(content);
            exitImageTexture = content.Load<Texture2D>("MenuGraphics/exitImage");
        }

        public void Draw(SpriteBatch sb)
        {
            DrawBaseElements(sb);
            sb.Draw(exitImageTexture, exitImageRect, Color.White);
        }

        public void Update(Microsoft.Xna.Framework.GameTime gameTime, MenuMainComponent menu)
        {
            KeyboardState newState = Keyboard.GetState();
            MouseState newMouseState = Mouse.GetState();

            if ((newState.IsKeyDown(Keys.Space)) && (!oldState.IsKeyDown(Keys.Space)))
            {
                ((GameManager)this.game).Exit();
            }
        }
    }
}
